<template>
  <div class="communicateList_middle">
    <div class="communicateList_middle_body">
      <div
        class="communicateList_middle_item"
        v-for="item in list"
        :key="item.id"
        @click="toChatRoom"
      >
        <div class="communicateList_middle_item_img">
          <img :src="item.imgUrl" alt="" />
        </div>
        <div class="communicateList_middle_item_right">
          <div class="communicateList_middle_item_name">
            <div class="communicateList_middle_names van-ellipsis">
              {{ item.name }}
            </div>
            <div class="communicateList_middle_time">
              {{ item.createTime }}
              <span><van-icon name="arrow" /></span>
            </div>
          </div>
          <div
            class="communicateList_middle_item_content van-multi-ellipsis--l3"
          >
            {{ item.content }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "communicateList",
  props: {
    list: {
      type: Array,
      default() {
        return [];
      },
      required: true,
    },
  },
  methods: {
    toChatRoom() {
      this.$router.push({ path: "/chatRoom" });
    },
  },

};
</script>

<style lang="scss" scope>
a {
  display: block;
  text-decoration: none;
}
.communicateList {
  &_middle {
    padding: 5px 15px 5px 15px;

    &_time {
      font-size: 15px;
      color: #acacae;
      display: inline-block;
      white-space: nowrap;
    }
    &_names {
      font-size: 16px;
      font-weight: 550;
      max-width: 150px;
    }
    &_item {
      margin: 5px 0;
      display: flex;
      padding: 5px 2px;
      position: relative;
      &_content {
        font-size: 15px;
        color: #c8c8ca;
      }
      &_name {
        margin-bottom: 5px;
        display: flex;
        align-items: center;
        justify-content: space-between;
      }
      &_right {
        min-height: 60px;
        width: 100%;
        margin-left: calc(5% + 55px);
      }
      &_img {
        width: 55px;
        height: 55px;
        border-radius: 50%;
        overflow: hidden;
        position: absolute;
        left: 2%;
        top: 10%;
        & img {
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
    }
  }
}
</style>
